class_name PlayerStatsSrc
extends StatsSrc

@export var initDeck:DeckSrc
@export var drawNum:int
@export var maxEnergy:int

var energy:int:set=setEnergy
var deck:DeckSrc
var discard:DeckSrc
var drawcards:DeckSrc

func init():
    super()
    resetEnergy()
    deck=initDeck.duplicate()
    discard=DeckSrc.new()
    drawcards=DeckSrc.new()

func setEnergy(val:int)->void:
    energy=val
    statsChanged.emit()

func resetEnergy()->void:
    energy=maxEnergy

func canPlay(card:CardSrc)->bool:
    return energy>=card.cost

func getHurt(hurt:int)->void:
    super(hurt)
    if armor<hurt:Game.playerHit.emit()